Class 3 Exam  >  Class 3 Questions  >  What happens in the following JavaScript code... Start Learning for Free
What happens in the following JavaScript code snippet?
var js = 0;
while (js < 10) 
{
     console.log(js);
     js++;
}
  • a)
    An exception is thrown
  • b)
    The values of js are logged or stored in a particular location or storage
  • c)
    The value of js from 0 to 9 is displayed in the console
  • d)
    An error is displayed
Correct answer is option 'C'. Can you explain this answer?
Most Upvoted Answer
What happens in the following JavaScript code snippet?var js = 0;while...
This code will result in an infinite loop.

The variable "js" is initially set to 0.

The while loop checks if "js" is less than 10. Since 0 is less than 10, the loop executes.

Inside the loop, the value of "js" is incremented by 1.

However, the condition of the while loop is always true since "js" is never greater than or equal to 10. Therefore, the loop will continue to run indefinitely, incrementing the value of "js" by 1 each time.
Free Test
Community Answer
What happens in the following JavaScript code snippet?var js = 0;while...
In JavaScript, Console.log is a predefined function that accepts the value as an argument. At the time of code execution, console.log prints this value in the argument to the console.
Attention Class 3 Students!
To make sure you are not studying endlessly, EduRev has designed Class 3 study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Class 3.
Explore Courses for Class 3 exam

Top Courses for Class 3

What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer?
Question Description
What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer? for Class 3 2024 is part of Class 3 preparation. The Question and answers have been prepared according to the Class 3 exam syllabus. Information about What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer? covers all topics & solutions for Class 3 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer?.
Solutions for What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Class 3. Download more important topics, notes, lectures and mock test series for Class 3 Exam by signing up for free.
Here you can find the meaning of What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer?, a detailed solution for What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer? has been provided alongside types of What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What happens in the following JavaScript code snippet?var js = 0;while (js < 10){ console.log(js); js++;}a)An exception is thrownb)The values of js are logged or stored in a particular location or storagec)The value of js from 0 to 9 is displayed in the consoled)An error is displayedCorrect answer is option 'C'. Can you explain this answer? tests, examples and also practice Class 3 tests.
Explore Courses for Class 3 exam

Top Courses for Class 3

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev